import os
import sys
from django.core.management import execute_from_command_line


# 将项目根目录添加到系统路径
project_path = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
if project_path not in sys.path:
    sys.path.append(project_path)
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mysite.settings")


# 模拟命令行参数，这里是启动runserver的命令
argv = ["", "runserver"]
execute_from_command_line(argv)
